package com.mylove.imagegrid;

import android.os.Bundle;
import android.util.Log;

import androidx.appcompat.app.AppCompatActivity;

import com.benyanyi.image_grid_lib.ImageRecycler;

public class MainActivity extends AppCompatActivity {


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        ImageRecycler recycler = findViewById(R.id.recycler);
        recycler.setOnAddImgClick(new ImageRecycler.OnAddImgClick() {
            @Override
            public void onAddImgClick() {
                Log.v("哈哈哈", "点击添加");
                recycler.addData("https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fpic38.nipic.com%2F20140226%2F18049074_195317304156_2.jpg&refer=http%3A%2F%2Fpic38.nipic.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1635757680&t=1b5448e37e37590016b8b07c1a6a1962");
            }
        });
        recycler.setOnRemoveClick(new ImageRecycler.OnRemoveClick() {
            @Override
            public void onRemoveClick(int position) {
                Log.d("当前删除的下标为：", position + "");
            }
        });
    }
}